package map.blocks;

import java.awt.Color;
import java.awt.Graphics;

import map.MapObject;
import map.PlayerObject;
import map.RasterCell;

public class Teleporter extends MapObject {
	
	public Teleporter(){
		properties.put("targetX", "0");
		properties.put("targetY", "0");
	}

	@Override
	public boolean interact(PlayerObject actor) {
		return false;
	}

	@Override
	public boolean entered(PlayerObject actor) {
		actor.setCurrentX(Integer.parseInt(properties.get("targetX")));
		actor.setCurrentY(Integer.parseInt(properties.get("targetY")));
		return true;
	}


	@Override
	public void deseriralize() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void paintComponent(Graphics arg0, RasterCell target) {
		arg0.setColor(Color.blue);
		arg0.fillOval(target.getCx()*target.RASTERSIZE, target.getCy()*target.RASTERSIZE, target.RASTERSIZE - 1, target.RASTERSIZE - 1);
	}

	@Override
	public MapObject newInstance() {
		return new Teleporter();
	}

}
